#第三章 列表
list=["maru","TY","clem","innovation","time","dream"]
list1=list[0:3:2]#(开始:结束:间隔）
list2=["states","classic","hero","zest","trap","neeb"]
list3=["rogue","dark","solar"]
list4=list1+list2[1:3:]+list3[1:3: ]
print(list4)
print(list2[0])
print(list[-1])#倒数
thought="My favorite player is "+list[0].title()+"."#例用
print(thought)
if "maru" not in list4:
    print("\nit is impossible.")
else:
    print("\nwell,it is sure.")
#汉字编码
print(max(list))
print(min(list))
listnum=(1,11,111,1111,2,22,222,2222)
print(max(listnum))
print(len(listnum))
print(min(listnum))
for item in list:
    print(item+"，该选手未晋级GSLS级比赛。")
for index,item in enumerate(list):
    print("选手排名：",index+1,"选手名称：",item)
list[1]="F91"#修改元素
list.insert(1,"TY")#插入元素
list.append("XY")#添加元素
list.extend(list2)#拓展元素
del list[2]#删除元素
print(list.index("maru"))#索引元素编号
list5=list.pop()#弹出元素，()表示为末位
print(list)
print(list5)
if list.count(0) >0:
    print("well done.")
else:
    print("oh,no.")
num=[1,2,3,4,5]
sum(num)
print(num)
num=num+[8,-1]*10
print(num)
num.sort(reverse=True)
print(num)
del num
num=[1,6,3,4,5,2]#排序
print(sorted(num))
import random
randomnuber=[random.randint(10,100) for z in range(10)]#随机生成
print(randomnuber)
price=[100,200,300,400,500]#打折实例
sale=[int(x*0.78) for x in price]
print(price)
print(sale)